<template>
  <div class="container">
    <DataList
      ref="dataList"
      :propAutoFetchData="true"
      :propNoCheck="true"
      :propSearchFields="['busKey','sn']"
      :propSearchTextAppend="'单号/标签码'"
      propUrl="/settlement/dept_oprt_use_items/pageSumDtl"
      :showFieldList="cpShowFieldList"
      :detailFormConfig="{enabled: true, title: '消耗详情'}"
      :vanFieldLabelWith5="true"
      :sortDefault="{field: 'busDate',type: 'desc'}"
    >
    </DataList>
  </div>
</template>

<script>

export default {
  help: '高值消耗明细-列表',
  data() {
    return {
    }
  },
  methods: {
    showDataFmtFun(data) {
      let index = 1
      data.forEach(item => {
        item.id = index
        index ++
      })
      return data
    }
  },
  computed: {
    cpShowFieldList() {
      /** 配置说明
       ,sortDisabled: true 不可排序
       ,filterDisabled: true  更多搜索时不展示
       ,filterOrder: 1  更多搜索字段显示顺序，不指定则按照传入字段顺序，可以只改某些字段顺序为负数，这样就可以排前面
       ,showDisabled: true  列表内容区域不显示
       ,showFormOpenDisabled: true  详情表单不显示
       ,showAllDisabled: true   表格、表单、搜索都不显示
       ,titleSubWithLabel: true   内容显示标题
       **/

      let fieldList = [
        { label: '消耗单号', name: 'busKey', span: 24, isTitle: true },
        { label: '标签码', name: 'sn', span: 24,sortDisabled: true },
        { label: '商品', name: 'matrName', span: 24 },
        { label: '规格', name: 'matrSpec', span: 24 },
        { label: '单品单位', name: 'skuUnit', span: 12,filterDisabled: true,sortDisabled: true },
        { label: '单价', name: 'skuPrice', span: 12,filterDisabled: true,sortDisabled: true },
        { label: '单品数量', name: 'skuQty', span: 12,filterDisabled: true,sortDisabled: true },
        { label: '金额', name: 'amount', span: 12,filterDisabled: true,sortDisabled: true },
        { label: '批次', name: 'lot', span: 12,showDisabled: true,sortDisabled: true },
        {
          label: '退费', name: 'flagUseRedType', span: 12, isTitleSub: true,isTitleSubWithLabel: true,flagBoolean: true,
          queryType: this.constCommon.formItemType.switch.name,
          queryConfig: {
            dictType: this.constCommon.dictType.commonYesNoReverse
          }
        },
        { label: '效期', name: 'expDate', span: 24,showDisabled: true,sortDisabled: true,filterDisabled: true },
        { label: '生产日期', name: 'mfgDate', span: 24,showDisabled: true,sortDisabled: true,filterDisabled: true },
        { label: 'UDI', name: 'udi', span: 24,showDisabled: true,sortDisabled: true },
        { label: '注册证号', name: 'certificateNo', span: 24,showDisabled: true,sortDisabled: true },
        { label: '厂商', name: 'mfgName', span: 24,showDisabled: true },
        { label: '说明', name: 'remark', span: 24,showDisabled: true,filterDisabled: true,sortDisabled: true },
        {
          label: '寄售', name: 'flagConsignment', span: 12,showDisabled: true,sortDisabled: true,flagBoolean: true,
          queryType: this.constCommon.formItemType.switch.name,
          queryConfig: {
            dictType: this.constCommon.dictType.commonYesNo
          }
        },
        {
          label: '标签管理', name: 'flagOmoc', span: 12,showDisabled: true,sortDisabled: true,flagBoolean: true,
          queryType: this.constCommon.formItemType.switch.name,
          queryConfig: {
            dictType: this.constCommon.dictType.commonYesNo
          }
        },

        {
          label: '消耗日期',
          name: 'busDate',
          span: 24,
          queryType: this.constCommon.formItemType.datePickerBetween.name,
        }
      ]
      fieldList = [...fieldList, ...this.constCommon.filterCommon.spAndHp()]
      return fieldList
    }
  }
}
</script>
